﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DataSetPage : MonoBehaviour
{
    public EventImage[] eventImages;

    public GameObject KonwlageGo;
    public Text konwlageTxt;
    public KonwlageSlecte[] konwlageSlectes;
    public Button goResultBtn;
    [Header("参数设置")]
    public GameObject dataSetGo;
    public DataSet[] dataSets;
    private int currentSlectedIndex = 0;
    private int okIndex = 0;

    private void Start()
    {
        for (int i = 0; i < dataSets.Length; i++)
        {
            int temp = i;
            dataSets[i].returnBtn.onClick.AddListener(() => {
                KonwlageGo.SetActive(false);
                dataSetGo.SetActive(false);
                dataSets[temp].gameObject.SetActive(false);

                eventImages[currentSlectedIndex].SetCanCtrl(false);
                okIndex++;
                if (okIndex >= dataSets.Length)
                {
                    goResultBtn.gameObject.SetActive(true);
                }

            }); 
        }

        


    }

    public void EnterKonwlage(int index)
    {
        KonwlageGo.SetActive(true);
        konwlageTxt.text = konwlageSlectes[index].info;
        currentSlectedIndex = index;

    }

    public void EnterDataSet()
    {
        dataSetGo.SetActive(true);
        dataSets[currentSlectedIndex].gameObject.SetActive(true);
    }

   

}
